home *** CD-ROM | disk | FTP | other *** search
/ MacAddict 104 / MacAddict_104_2005-04.iso / Software / Internet & Communication / WordPress 1.2.2 freeware.dmg / wordpress / wp-admin / edit.php < prev    next >
Encoding:
PHP Script  |  2004-12-16  |  6.3 KB  |  181 lines

  1. <?php
  2. require_once('../wp-includes/wp-l10n.php');
  3.  
  4. $title = __('Posts');
  5. require_once('admin-header.php');
  6.  
  7. ?>
  8.  <ul id="adminmenu2"> 
  9.   <li><a href="edit.php" class="current"><?php _e('Posts') ?></a></li> 
  10.   <li><a href="edit-comments.php"><?php _e('Comments') ?></a></li> 
  11.   <li class="last"><a href="moderation.php"><?php _e('Awaiting Moderation') ?></a></li> 
  12. </ul> 
  13. <?php
  14. get_currentuserinfo();
  15. $drafts = $wpdb->get_results("SELECT ID, post_title FROM $tableposts WHERE post_status = 'draft' AND post_author = $user_ID");
  16. if ($drafts) {
  17.     ?> 
  18. <div class="wrap"> 
  19.     <p><strong><?php _e('Your Drafts:') ?></strong> 
  20.     <?php
  21.     $i = 0;
  22.     foreach ($drafts as $draft) {
  23.         if (0 != $i)
  24.             echo ', ';
  25.         $draft->post_title = stripslashes($draft->post_title);
  26.         if ($draft->post_title == '')
  27.             $draft->post_title = sprintf(__('Post #%s'), $draft->ID);
  28.         echo "<a href='post.php?action=edit&post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>";
  29.         ++$i;
  30.         }
  31.     ?> 
  32.     .</p> 
  33. </div> 
  34. <?php
  35. }
  36. ?> 
  37. <div class="wrap"> 
  38. <?php
  39. if( isset( $_GET['m'] ) )
  40. {
  41. $_GET['m'] = (int) $_GET['m'];
  42.     echo '<h2>' . $month[substr( $_GET['m'], 4, 2 )]." ".substr( $_GET['m'], 0, 4 )."</h2>";
  43. }
  44. ?>
  45.  
  46. <form name="viewarc" action="" method="get" style="float: left; width: 20em;">
  47.     <fieldset>
  48.     <legend><?php _e('Show Posts From Month of...') ?></legend>
  49.     <select name='m'>
  50.     <?php
  51.         $arc_result=$wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $tableposts ORDER BY post_date DESC");
  52.         foreach ($arc_result as $arc_row) {            
  53.             $arc_year  = $arc_row->yyear;
  54.             $arc_month = $arc_row->mmonth;
  55.             
  56.             if( isset($_GET['m']) && $arc_year . zeroise($arc_month, 2) == $_GET['m'] )
  57.                 $default = 'selected="selected"';
  58.             else
  59.                 $default = null;
  60.             
  61.             echo "<option $default value=\"" . $arc_year.zeroise($arc_month, 2) . '">';
  62.             echo $month[zeroise($arc_month, 2)] . " $arc_year";
  63.             echo "</option>\n";
  64.         }
  65.     ?>
  66.     </select>
  67.         <input type="submit" name="submit" value="<?php _e('Show Month') ?>"  /> 
  68.     </fieldset>
  69. </form>
  70. <form name="searchform" action="" method="get" style="float: left; width: 20em; margin-left: 3em;"> 
  71.   <fieldset> 
  72.   <legend><?php _e('Show Posts That Contain...') ?></legend> 
  73.   <input type="text" name="s" value="<?php if (isset($s)) echo wp_specialchars($s, 1); ?>" size="17" /> 
  74.   <input type="submit" name="submit" value="<?php _e('Search') ?>"  /> 
  75.   </fieldset>
  76. </form>
  77.  
  78. <br style="clear:both;" />
  79.  
  80. <table width="100%" cellpadding="3" cellspacing="3"> 
  81.   <tr> 
  82.     <th scope="col"><?php _e('ID') ?></th> 
  83.     <th scope="col"><?php _e('When') ?></th> 
  84.     <th scope="col"><?php _e('Title') ?></th> 
  85.     <th scope="col"><?php _e('Categories') ?></th> 
  86.     <th scope="col"><?php _e('Comments') ?></th> 
  87.     <th scope="col"><?php _e('Author') ?></th> 
  88.     <th scope="col"><?php _e('Edit') ?></th> 
  89.     <th scope="col"><?php _e('Delete') ?></th> 
  90.   </tr> 
  91. <?php
  92. if (empty($m)) $showposts = 15;
  93. include(ABSPATH.'wp-blog-header.php');
  94.  
  95. if ($posts) {
  96. $bgcolor = '';
  97. foreach ($posts as $post) { start_wp();
  98. $bgcolor = ('#eee' == $bgcolor) ? 'none' : '#eee';
  99. ?> 
  100.   <tr style='background-color: <?php echo $bgcolor; ?>'> 
  101.     <th scope="row"><?php echo $id ?></th> 
  102.     <td><?php the_time('Y-m-d \<\b\r \/\> g:i:s a'); ?></td> 
  103.     <td><a href="<?php the_permalink(); ?>" rel="permalink"> 
  104.       <?php the_title() ?> 
  105.       </a> 
  106.     <?php if ('private' == $post->post_status) _e(' - <strong>Private</strong>'); ?></td> 
  107.     <td><?php the_category(','); ?></td> 
  108.     <td><a href="edit.php?p=<?php echo $id ?>&c=1"> 
  109.       <?php comments_number(__('no comments'), __('1 comment'), __("% comments")) ?> 
  110.       </a></td> 
  111.     <td><?php the_author() ?></td> 
  112.     <td><?php if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) { echo "<a href='post.php?action=edit&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td> 
  113.     <td><?php if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) { echo "<a href='post.php?action=delete&post=$id' class='delete' onclick=\"return confirm('" . sprintf(__("You are about to delete this post \'%s\'\\n  \'OK\' to delete, \'Cancel\' to stop."), the_title('','',0)) . "')\">" . __('Delete') . "</a>"; } ?></td> 
  114.   </tr> 
  115. <?php
  116. }
  117. } else {
  118. ?>
  119.   <tr style='background-color: <?php echo $bgcolor; ?>'> 
  120.     <td colspan="8"><?php _e('No posts found.') ?></td> 
  121.   </tr> 
  122. <?php
  123. } // end if ($posts)
  124. ?> 
  125. </table> 
  126. <?php
  127. if ( 1 == count($posts) ) {
  128.  
  129.     $comments = $wpdb->get_results("SELECT * FROM $tablecomments WHERE comment_post_ID = $id ORDER BY comment_date");
  130.     if ($comments) {
  131.     ?> 
  132. <h3><?php _e('Comments') ?></h3> 
  133. <ol id="comments"> 
  134. <?php
  135. foreach ($comments as $comment) {
  136. $comment_status = wp_get_comment_status($comment->comment_ID);
  137. ?> 
  138.  
  139. <li <?php if ("unapproved" == $comment_status) echo "class='unapproved'"; ?> >
  140.   <?php comment_date('Y-n-j') ?> 
  141.   @
  142.   <?php comment_time('g:m:s a') ?> 
  143.   <?php 
  144.             if (($user_level > $authordata->user_level) or ($user_login == $authordata->user_login)) {
  145.                 echo "[ <a href=\"post.php?action=editcomment&comment=".$comment->comment_ID."\">" .  __('Edit') . "</a>";
  146.                 echo " - <a href=\"post.php?action=deletecomment&p=".$post->ID."&comment=".$comment->comment_ID."\" onclick=\"return confirm('" . sprintf(__("You are about to delete this comment by \'%s\'\\n  \'OK\' to delete, \'Cancel\' to stop."), $comment->comment_author) . "')\">" . __('Delete') . "</a> ";
  147.                 if ( ('none' != $comment_status) && ($user_level >= 3) ) {
  148.                     if ('approved' == wp_get_comment_status($comment->comment_ID)) {
  149.                         echo " - <a href=\"post.php?action=unapprovecomment&p=".$post->ID."&comment=".$comment->comment_ID."\">" . __('Unapprove') . "</a> ";
  150.                     } else {
  151.                         echo " - <a href=\"post.php?action=approvecomment&p=".$post->ID."&comment=".$comment->comment_ID."\">" . __('Approve') . "</a> ";
  152.                     }
  153.                 }
  154.                 echo "]";
  155.             } // end if any comments to show
  156.             ?> 
  157.   <br /> 
  158.   <strong> 
  159.   <?php comment_author() ?> 
  160.   (
  161.   <?php comment_author_email_link() ?> 
  162.   /
  163.   <?php comment_author_url_link() ?> 
  164.   )</strong> (IP:
  165.   <?php comment_author_IP() ?> 
  166.   )
  167.   <?php comment_text() ?> 
  168.  
  169. </li> 
  170. <!-- /comment --> 
  171. <?php //end of the loop, don't delete
  172.         } // end foreach
  173.     echo '</ol>';
  174.     }//end if comments
  175.     ?>
  176. <?php } ?> 
  177. </div> 
  178. <?php 
  179.  include('admin-footer.php');
  180. ?> 
  181.